09. Tabletop Segmentation Exercise

Tabletop Segmentation Exercise

This exercise represents the first piece of the perception pipeline that you will be implementing in the project. The upcoming sections of this lesson will guide you through a step-by-step process to completing this exercise. You will apply various filters to simulated point cloud data, and finally perform RANSAC segmentation to isolate objects in the scene. To complete this exercise you will be using python-pcl, a library of Python bindings for the powerful Point Cloud Library.

Your task is to:

  • Step-1. Download or clone this repository in the provided course VM and follow the setup instructions.
  • Step-2. Experiment with the various filters in the upcoming sections.
  • Step-3. Perform RANSAC plane fitting to segment the table in the scene
  • Step-4. Save two new point cloud files containing only the table and the objects, respectively.

In the repository, you are provided with Point Cloud data for the simulated tabletop scene in the form of a single file: tabletop.pcd. In the end, your goal is to create two separate Point Cloud files:

  • Table.pcd - Containing only the points that belong to the table
  • Objects.pcd - Containing all the tabletop objects

To accomplish these tasks, you will modify the code in the RANSAC.py script, which is provided in the repository in the Exercise-1 folder. The script looks like this:

# Import PCL module
import pcl

# Load point cloud file
cloud = pcl.load_XYZRGB('tabletop.pcd')

# Voxel Grid filter
# Implement Voxel Grid Downsampling here

# Pass Through filter
# Implement a Pass Through Filter here

# RANSAC plane segmentation
# Implement plane segmentation here

# Extract inliers
# Implement inlier extraction here

# Save output point cloud data 
# example: filename = 'table.pcd' for table
# pcl.save(cloud, filename)

# Extract outliers

# Save pcd for tabletop objects

The upcoming sections will walk you through these concepts and help you implement the above, allowing you to experiment with point cloud filtering and RANSAC!